﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ZhiAo.CommonLibrary
{
    public static class DateTimeExtend
    {

        public static string ToyyyyMMddHHmmss(this DateTime date)
        {
            return date.ToString("yyyyMMddHHmmss");
        }

        public static string ToFullString(this DateTime date)
        {
            return date.ToString("yyyy-MM-dd HH:mm:ss");
        }

        public static string ToMyString(this  DateTime? date, string format)
        {
            if (!date.HasValue) return "";
            return date.Value.ToString(format);
        }


        public static DateTime Parse(this string key)
        {
            return DateTime.Parse(key);
        }
    }
}
